package cn.regexp.demo.ui;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.regexp.demo.entity.Discussion;
import lombok.Getter;
import lombok.Setter;

import javax.swing.*;

/**
 * @author Regexpei
 * @date 2024/6/12 22:41
 * @description 讨论面板
 */
@Getter
@Setter
public class DiscussionPanel {
    private JLabel username;
    private JLabel content;
    private JLabel createTime;
    private JPanel mainPanel;

    public DiscussionPanel(Discussion discussion) {
        this.username.setText(discussion.getUsername() + "：");
        this.content.setText(discussion.getContent());
        this.createTime.setText(DateUtil.format(discussion.getCreateTime(), DatePattern.NORM_DATETIME_PATTERN));
    }
}
